#!/usr/bin/env bash

PREFIX=$(realpath $(cd "$(dirname "$0")"; pwd))

cd $PREFIX

adb root
adb shell "rm /data/ubuntu.ext4*"
adb push ubuntu.ext4.tar.xz /data/
adb shell "cd /data/;xz -d ubuntu.ext4.tar.xz;tar xvf ubuntu.ext4.tar;rm ubuntu.ext4.tar;busybox mkdir ubuntu;busybox mount -t ext4 -o loop ubuntu.ext4 ubuntu;"
adb push ubuntu.sh /data
adb shell "chmod +x /data/ubuntu.sh;/data/ubuntu.sh"
